package com.my.consumer.config;

import com.my.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * 全局异常处理器
 * @author zhaodongchao
 * @date 2020/3/14 21:01
 **/
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value ={Exception.class})
    @ResponseBody
    public Result handException(Exception e){
        return Result.error(e.getMessage());
    }
}
